#!/usr/bin/env python
# encoding: UTF-8

__version__ = "$Revision: 11 $"



class Lod(pygame.sprite.Sprite):
    """Base class for all ships.
    
    vzhled attribute defines the ship's shape, it's a 2d array (always 5x5),
           initially, the ship is oriented to the east (->)
           meaning of the values is following:  0 - nothing
                                                1 - ship body
                                                2 - damaged
                                                3 - destroyed"""
    EAST  = 0
    NORTH = 1
    WEST  = 2
    SOUTH = 3
    
    INIT_TILESIZE = 30
    
    orientation = EAST
    images = None
    # pozor, vzhled[y][x]
    #~ vzhled = [  [0, 0, 0, 0, 0],
                #~ [0, 0, 0, 0, 0],
                #~ [0, 1, 1, 1, 0],
                #~ [0, 0, 0, 0, 0],
                #~ [0, 0, 0, 0, 0]]
    def __init__(self, groups=[]):
        pygame.sprite.Sprite.__init__(self, groups)
        image = self.__class__.__name__ + "_%s_E.png" % self.INIT_TILESIZE
        if self.__class__.images is None:
            self.__class__.images = [None,]*4
            self.__class__.images[Lod.EAST] = helpers.load_image(image, transparency=True)
        self.image = self.__class__.images[self.orientation]
        self.rect = self.image.get_rect()

class Destroyer(Lod):
    vzhled = [  [0, 0, 0, 0, 0],
                [0, 0, 0, 0, 0],
                [0, 1, 1, 1, 0],
                [0, 0, 0, 0, 0],
                [0, 0, 0, 0, 0]]
class Battlecruiser(Lod):
    vzhled = [  [0, 0, 0, 0, 0],
                [0, 0, 0, 0, 0],
                [0, 1, 1, 1, 0],
                [1, 1, 1, 1, 1],
                [0, 0, 0, 0, 0]]
                    
class Submarine(Lod):
    vzhled = [  [0, 0, 0, 0, 0],
                [0, 0, 0, 0, 0],
                [0, 0, 1, 0, 0],
                [0, 0, 0, 0, 0],
                [0, 0, 0, 0, 0]]
